import request from '../plugins/axios'

// --------------------------分类 START

// 查询所有分类
export const GetAllCategory = () => {
    return request({
        url: 'category',
        method: 'get'
    })
}

// --------------------------分类 END

// --------------------------文章 START

export const GetArticleCount = () => {
  return request({
    url: 'article/count',
    method: 'get',
  })
}

// 条件查询文章 带分页
export const GetArticle = (params) => {
    return request({
        url: 'article',
        method: 'get',
        params
    })
}

export const GetOneArticle = (params) => {
    return request({
        url: 'article',
        method: 'get',
        params
    })
}

export const GetHotArticle = (params) => {
  return request({
    url: 'article/hot',
    method: 'get',
    params
  })
}

// 更新一下likes的数量
export const UpdateArticleLikes = (params) => {
    return request({
        url: 'article/likes',
        method: 'post',
        data: params
    })
}
// --------------------------文章 END

// --------------------------标签 START
// 标签榜单
export const GetTopTag = () => {
    return request({
        url: 'tag/top',
        method: 'get'
    })
}
// --------------------------标签 END
